﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using YJKRevitBase.Math;
using YJKRevitKernel.CurveUtility.CurveGroupSuite;
using YJKRevitKernel.RevitTopologySuite;
using YJKRevitKernel.XYZUtility;
using YJKGeometryFuncs;
using YJKCopyModel.CommonTrans;
using YJKCopyModel.InteractiveOperation;
using YJKPresentation.Utils;

namespace YJKCopyModel.DuctFastModel
{
	public class JudgeGroup
	{
		public void DuctLineTextGroup2(List<DuctHeight> lstDuctHeights, ref Dictionary<int, DuctInfo> lstDoubleParaleCurves)
		{
			double num = 0.0;
			List<KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>>> list = new List<KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>>>();
			foreach (DuctHeight ductHeight in lstDuctHeights)
			{
				KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>> item = default(KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>>);
				double num2 = double.MaxValue;
				bool flag = false;
				using (Dictionary<int, DuctInfo>.Enumerator enumerator2 = lstDoubleParaleCurves.GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						KeyValuePair<int, DuctInfo> doubleCurve = enumerator2.Current;
						bool flag2 = !list.Contains((KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>> a) => a.Key == doubleCurve.Key) && this.IfDuctAndTextIsConnected(doubleCurve.Value.ParaleCurve.LocationCurve, ductHeight, ref num);
						if (flag2)
						{
							bool flag3 = num < num2;
							if (flag3)
							{
								num2 = num;
								item = new KeyValuePair<int, KeyValuePair<DuctInfo, DuctHeight>>(doubleCurve.Key, new KeyValuePair<DuctInfo, DuctHeight>(doubleCurve.Value, ductHeight));
								flag = true;
							}
						}
					}
				}
				bool flag4 = flag;
				if (flag4)
				{
					list.Add(item);
					DuctInfo ductInfo = new DuctInfo();
					lstDoubleParaleCurves.TryGetValue(item.Key, out ductInfo);
					ductInfo.Height = item.Value.Value;
				}
			}
		}

		public void DuctLineTextGroup(List<DuctHeight> lstDuctHeights, ref Dictionary<int, DuctInfo> lstDoubleParaleCurves)
		{
			bool flag = lstDoubleParaleCurves.IsEmpty<KeyValuePair<int, DuctInfo>>() || lstDuctHeights.IsEmpty<DuctHeight>();
			if (!flag)
			{
				List<DuctHeight> list = new List<DuctHeight>(lstDuctHeights);
				Dictionary<int, List<DuctHeight>> dictionary = new Dictionary<int, List<DuctHeight>>();
				foreach (KeyValuePair<int, DuctInfo> keyValuePair in lstDoubleParaleCurves)
				{
					List<DuctHeight> nearTextNotes = this.GetNearTextNotes(list, keyValuePair.Value);
					bool flag2 = nearTextNotes.IsEmpty<DuctHeight>();
					if (!flag2)
					{
						foreach (DuctHeight item in nearTextNotes)
						{
							bool flag3 = list.Contains(item);
							if (flag3)
							{
								list.Remove(item);
							}
						}
						dictionary.Add(keyValuePair.Key, nearTextNotes);
					}
				}
			}
		}

		public List<DuctHeight> GetNearTextNotes(List<DuctHeight> lstDuctHeights, DuctInfo ductInfo)
		{
			List<DuctHeight> list = new List<DuctHeight>();
			bool flag = lstDuctHeights.IsEmpty<DuctHeight>();
			List<DuctHeight> result;
			if (flag)
			{
				result = list;
			}
			else
			{
				double num = double.MaxValue;
				DuctHeight ductHeight = null;
				Dictionary<DuctHeight, double> dictionary = new Dictionary<DuctHeight, double>();
				foreach (DuctHeight ductHeight2 in lstDuctHeights)
				{
					double num2 = 0.0;
					bool textNoteIsNear = this.GetTextNoteIsNear(ductHeight2, ductInfo, out num2);
					if (textNoteIsNear)
					{
						bool flag2 = JudgeGroup.CheckTextIsHaveX(ductHeight2.TextInfo.UseText);
						bool flag3 = flag2 && !dictionary.ContainsKey(ductHeight2);
						if (flag3)
						{
							dictionary.Add(ductHeight2, num2);
						}
						bool flag4 = num2 < num;
						if (flag4)
						{
							ductHeight = ductHeight2;
							num = num2;
						}
						list.Add(ductHeight2);
					}
				}
				bool flag5 = list.Count <= 0 || ductHeight == null;
				if (flag5)
				{
					result = list;
				}
				else
				{
					bool flag6 = dictionary.Count > 0;
					if (flag6)
					{
						Dictionary<DuctHeight, double> dictionary2 = (from o in dictionary
						orderby o.Value
						select o).ToDictionary((KeyValuePair<DuctHeight, double> o) => o.Key, (KeyValuePair<DuctHeight, double> o) => o.Value);
						using (Dictionary<DuctHeight, double>.Enumerator enumerator2 = dictionary2.GetEnumerator())
						{
							if (enumerator2.MoveNext())
							{
								KeyValuePair<DuctHeight, double> keyValuePair = enumerator2.Current;
								ductHeight = keyValuePair.Key;
							}
						}
					}
					List<TextInfo> lstAllText = list.ConvertAll<TextInfo>((DuctHeight thisItem) => thisItem.TextInfo);
					string strMerge = GeometryCommon.MergeNearTextNote(ductHeight.TextInfo, lstAllText);
					string empty = string.Empty;
					List<DuctHeight> list2 = new List<DuctHeight>();
					bool flag7 = this.CheckTextNoteIsRight(strMerge, out empty);
					if (flag7)
					{
						ductHeight.dDuctHeight = empty;
						ductInfo.Height = ductHeight;
						list2.Add(ductHeight);
					}
					result = list2;
				}
			}
			return result;
		}

		private bool CheckTextNoteIsRight(string strMerge, out string height)
		{
			height = string.Empty;
			string text = JudgeGroup.AnalyzeText(strMerge);
			bool flag = !JudgeGroup.IsNumber(text);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = !DataEnum.DuctHeight().Contains(text);
				if (flag2)
				{
					result = false;
				}
				else
				{
					height = text;
					result = true;
				}
			}
			return result;
		}

		public bool GetTextNoteIsNear(DuctHeight inputHeight, DuctInfo ductInfo, out double distance)
		{
			distance = 0.0;
			bool flag = inputHeight == null || ductInfo == null || ductInfo.ParaleCurve == null || ductInfo.ParaleCurve.LocationCurve == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				Curve locationCurve = ductInfo.ParaleCurve.LocationCurve;
				XYZ b = (locationCurve.GetEndPoint(0) - locationCurve.GetEndPoint(1)).Normalize();
				XYZ xyz = (locationCurve.GetEndPoint(1) - locationCurve.GetEndPoint(0)).Normalize();
				bool flag2 = YJKGeometryFuncs.Geometry.IsParallel(inputHeight.TextInfo.GetBaseLine().Direction.Normalize(), b);
				bool flag3 = !flag2;
				if (flag3)
				{
					result = false;
				}
				else
				{
					XYZ endPoint = locationCurve.GetEndPoint(0);
					XYZ endPoint2 = locationCurve.GetEndPoint(1);
					Line baseLine = inputHeight.TextInfo.GetBaseLine();
					XYZ endPoint3 = baseLine.GetEndPoint(0);
					XYZ endPoint4 = baseLine.GetEndPoint(1);
					XYZ xyz2 = YJKGeometryFuncs.Geometry.CalculatMidPoint(endPoint3, endPoint4);
					XYZ xyz3 = xyz2.Add(inputHeight.TextInfo.GetHightDirection() / 2.0);
					bool flag4 = endPoint.DistanceTo(endPoint2) < Common.MMToFeet(1.0);
					if (flag4)
					{
						result = false;
					}
					else
					{
						xyz3 = new XYZ(xyz3.X, xyz3.Y, XYZ.Zero.Z);
						XYZ projectPoint = this.GetProjectPoint(endPoint, endPoint2, xyz3);
						bool flag5 = !this.CheckPointIsInLine(endPoint, endPoint2, projectPoint);
						if (flag5)
						{
							result = false;
						}
						else
						{
							distance = xyz3.DistanceTo(projectPoint);
							double val = Common.MMToFeet(DuctFormData.m_dMaxDistance) + inputHeight.TextInfo.ActualHight / 2.0;
							bool flag6 = YJKGeometryFuncs.Geometry.Lessthan_Or_Equal(distance, val);
							result = flag6;
						}
					}
				}
			}
			return result;
		}

		private XYZ GetProjectPoint(XYZ lineStart, XYZ lineEnd, XYZ point)
		{
			XYZ xyz = (lineEnd - lineStart).Normalize();
			return lineStart + (point - lineStart).DotProduct(xyz) * xyz;
		}

		private bool CheckPointIsInLine(XYZ lineStart, XYZ lineEnd, XYZ point)
		{
			return point.DistanceTo(lineStart) + point.DistanceTo(lineEnd) <= lineStart.DistanceTo(lineEnd);
		}

		public static bool CheckTextIsHaveX(string strText)
		{
			bool flag = string.IsNullOrEmpty(strText);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = strText.Contains("*") || strText.Contains("×") || strText.Contains("x") || strText.Contains("X");
				result = flag2;
			}
			return result;
		}

		public static string AnalyzeText(string strText)
		{
			string text = string.Empty;
			strText = strText.Replace('*', '§');
			strText = strText.Replace('×', '§');
			strText = strText.Replace('x', '§');
			strText = strText.Replace('X', '§');
			string[] array = strText.Split(new char[]
			{
				'§'
			});
			bool flag = array.Length == 1;
			if (flag)
			{
				foreach (char c in array[0])
				{
					bool flag2 = JudgeGroup.IsNumber(c.ToString());
					if (!flag2)
					{
						break;
					}
					text += c.ToString();
				}
			}
			else
			{
				bool flag3 = array.Length > 1;
				if (flag3)
				{
					foreach (char c2 in array[1])
					{
						bool flag4 = JudgeGroup.IsNumber(c2.ToString());
						if (!flag4)
						{
							break;
						}
						text += c2.ToString();
					}
				}
			}
			return text;
		}

		public static bool IsNumber(string str)
		{
			bool flag = string.IsNullOrWhiteSpace(str);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				Regex regex = new Regex("^[0-9]*$");
				result = regex.IsMatch(str);
			}
			return result;
		}

		internal bool IfDuctAndTextIsConnected(Curve locationCurve, DuctHeight inputHeight, ref double dDistance)
		{
			XYZ b = (locationCurve.GetEndPoint(0) - locationCurve.GetEndPoint(1)).Normalize();
			XYZ xyz = (locationCurve.GetEndPoint(1) - locationCurve.GetEndPoint(0)).Normalize();
			bool flag = YJKGeometryFuncs.Geometry.IsParallel(inputHeight.TextInfo.GetBaseLine().Direction.Normalize(), b);
			bool flag2 = !flag;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				XYZ endPoint = locationCurve.GetEndPoint(0);
				XYZ endPoint2 = locationCurve.GetEndPoint(1);
				Line baseLine = inputHeight.TextInfo.GetBaseLine();
				XYZ endPoint3 = baseLine.GetEndPoint(0);
				XYZ endPoint4 = baseLine.GetEndPoint(1);
				XYZ xyz2 = YJKGeometryFuncs.Geometry.CalculatMidPoint(endPoint3, endPoint4);
				XYZ xyz3 = xyz2.Add(inputHeight.TextInfo.GetHightDirection() * inputHeight.TextInfo.UseHight / 2.0);
				bool flag3 = endPoint.DistanceTo(endPoint2) < Common.MMToFeet(1.0);
				if (flag3)
				{
					result = false;
				}
				else
				{
					Line line = Line.CreateBound(endPoint, endPoint2);
					bool flag4 = this.IsPointUnderLine(endPoint, endPoint2, endPoint3) || this.IsPointUnderLine(endPoint, endPoint2, endPoint4);
					if (flag4)
					{
						double val = Math.Max(endPoint.X, endPoint2.X);
						double val2 = Math.Max(endPoint.Y, endPoint2.Y);
						double val3 = Math.Min(endPoint.X, endPoint2.X);
						double val4 = Math.Min(endPoint.Y, endPoint2.Y);
						bool flag5 = MathUtility.IsEqual(endPoint.X, endPoint2.X, 1.0);
						if (flag5)
						{
							bool flag6 = MathUtility.GreaterThan(xyz2.Y, val2) || MathUtility.LessThan(xyz2.Y, val4);
							if (flag6)
							{
								return false;
							}
						}
						else
						{
							bool flag7 = MathUtility.IsEqual(endPoint.Y, endPoint2.Y, 1.0);
							if (flag7)
							{
								bool flag8 = MathUtility.GreaterThan(xyz2.X, val) || MathUtility.LessThan(xyz2.X, val3);
								if (flag8)
								{
									return false;
								}
							}
						}
						line.MakeUnbound();
						double num = line.Distance(new XYZ(xyz2.X, xyz2.Y, XYZ.Zero.Z));
						double num2 = line.Distance(new XYZ(xyz3.X, xyz3.Y, XYZ.Zero.Z));
						dDistance = ((num < num2) ? num : num2);
						double num3 = Convert.ToDouble(DuctFormData.m_dMaxDistance);
						double val5 = Convert.ToDouble(inputHeight.dDuctHeight) + num3;
						bool flag9 = YJKGeometryFuncs.Geometry.Lessthan_Or_Equal(dDistance, num3) || YJKGeometryFuncs.Geometry.Lessthan_Or_Equal(dDistance, val5);
						result = flag9;
					}
					else
					{
						result = false;
					}
				}
			}
			return result;
		}

		private bool IsPointUnderLine(XYZ Spt, XYZ Ept, XYZ point)
		{
			XYZ xyz = Spt - Ept;
			XYZ xyz2 = Spt - point;
			double val = xyz.AngleTo(xyz2);
			XYZ xyz3 = Ept - Spt;
			XYZ xyz4 = Ept - point;
			double val2 = xyz3.AngleTo(xyz4);
			double val3 = 1.571;
			bool flag = YJKGeometryFuncs.Geometry.GreaterThan(val, val3) || YJKGeometryFuncs.Geometry.GreaterThan(val2, val3);
			return !flag;
		}

		public List<List<Curve>> FitCurveArea(DuctRequest ductRequest)
		{
			List<List<Curve>> list = new List<List<Curve>>();
			List<Curve> list2 = new List<Curve>();
			list2.AddRange(ductRequest.LstFlangeCurveInfos);
			List<Curve> list3 = new List<Curve>();
			list3.AddRange(ductRequest.LstAllCurve);
			foreach (DoubleParaleCurve doubleParaleCurve in ductRequest.LstInitDoubleParaleCurve)
			{
				for (int i = 0; i < list3.Count; i++)
				{
					bool flag = this.CheckTwoCurveIsSame(doubleParaleCurve.FirstParalelCurve, list3[i]) || this.CheckTwoCurveIsSame(doubleParaleCurve.SecondParalelCurve, list3[i]);
					if (flag)
					{
						list3.RemoveAt(i);
						i--;
					}
				}
			}
			list2.AddRange(list3);
			List<ICurveGeter> list4 = list2.ConvertAll<ICurveGeter>((Curve thisCurev) => new CurveGeterBean
			{
				UseCurve = thisCurev
			});
			ToleranceManger toleranceManger = ToleranceManger.GetToleranceManger();
			double tolerance = toleranceManger.GetTolerance("风管快模容差(mm)");
			for (int j = 0; j < list4.Count; j++)
			{
				Curve useCurve = list4[j].UseCurve;
				bool flag2 = useCurve is Arc;
				if (flag2)
				{
					list4[j].UseCurve = Line.CreateBound(useCurve.GetEndPoint(0), useCurve.GetEndPoint(1));
				}
			}
			Dictionary<Curve, ICurveGeter> dictionary = CurveGroupManger.MakeExtendCurve(list4, tolerance);
			JudgeGroup.LstTmpCurves.AddRange(dictionary.Keys.ToList<Curve>());
			List<List<Curve>> list5 = CurveGroupManger.GroupCurvesByIntersection(dictionary.Keys.ToList<Curve>());
			foreach (List<Curve> lstInputCurves in list5)
			{
				List<RevitPolygonDataBean> list6 = new List<RevitPolygonDataBean>();
				List<RevitPolygonDataBean> list7 = new List<RevitPolygonDataBean>();
				RevitPolygonFinder revitPolygonFinder = new RevitPolygonFinder();
				bool flag3 = revitPolygonFinder.TryGetPolygon(lstInputCurves, out list6, out list7, true, 3, false);
				if (flag3)
				{
					bool flag4 = list6.Count > 0;
					if (flag4)
					{
						foreach (RevitPolygonDataBean revitPolygonDataBean in list6)
						{
							bool flag5 = revitPolygonDataBean != null && revitPolygonDataBean.LstRevitCurve != null && revitPolygonDataBean.LstRevitCurve.Count > 3;
							if (flag5)
							{
								list.Add(revitPolygonDataBean.LstRevitCurve);
							}
						}
					}
				}
			}
			return list;
		}

		public bool CheckTwoCurveIsSame(Curve c1, Curve c2)
		{
			bool flag = c1 == null || c2 == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				double num = Common.MMToFeet(1.0);
				bool flag2 = (c1.GetEndPoint(0).DistanceTo(c2.GetEndPoint(0)) < num && c1.GetEndPoint(1).DistanceTo(c2.GetEndPoint(1)) < num) || (c1.GetEndPoint(0).DistanceTo(c2.GetEndPoint(1)) < num && c1.GetEndPoint(1).DistanceTo(c2.GetEndPoint(0)) < num);
				result = flag2;
			}
			return result;
		}

		public void DuctCurveGroupByFit(List<List<Curve>> fitCurve, ref Dictionary<int, DuctInfo> lstDoubleParaleCurves)
		{
			ConcurrentDictionary<int, DuctInfo> dicInfo = new ConcurrentDictionary<int, DuctInfo>();
			foreach (KeyValuePair<int, DuctInfo> keyValuePair in lstDoubleParaleCurves)
			{
				dicInfo.TryAdd(keyValuePair.Key, keyValuePair.Value);
			}
			ToleranceManger toleranceManger = ToleranceManger.GetToleranceManger();
			double dTol = toleranceManger.GetTolerance("判断连接关系制备延长线");
			ParallelLoopResult parallelLoopResult = Parallel.ForEach<List<Curve>>(fitCurve, delegate(List<Curve> fitLoop, ParallelLoopState loopState, long loopIndex)
			{
				try
				{
					Dictionary<int, int> dictionary = new Dictionary<int, int>();
					foreach (KeyValuePair<int, DuctInfo> keyValuePair2 in dicInfo)
					{
						Line line = keyValuePair2.Value.ParaleCurve.LocationCurve as Line;
						Curve curve = line.Clone();
						curve.MakeUnbound();
						double parameter = curve.Project(line.GetEndPoint(0)).Parameter;
						double parameter2 = curve.Project(line.GetEndPoint(1)).Parameter;
						double num = (parameter2 - parameter) * UnitUtility.MMToFeet(dTol) / line.Length;
						curve.MakeBound(parameter - num, parameter2 + num);
						bool flag = XYZUtilityMethod.PointInPloygon(fitLoop, curve.GetEndPoint(0)) >= 0;
						if (flag)
						{
							bool flag2 = !dictionary.ContainsKey(keyValuePair2.Key);
							if (flag2)
							{
								dictionary.Add(keyValuePair2.Key, 0);
							}
						}
						else
						{
							bool flag3 = XYZUtilityMethod.PointInPloygon(fitLoop, curve.GetEndPoint(1)) >= 0;
							if (flag3)
							{
								bool flag4 = !dictionary.ContainsKey(keyValuePair2.Key);
								if (flag4)
								{
									dictionary.Add(keyValuePair2.Key, 1);
								}
							}
						}
					}
					bool flag5 = dictionary.Count > 1;
					if (flag5)
					{
						foreach (KeyValuePair<int, int> keyValuePair3 in dictionary)
						{
							DuctInfo ductInfo = new DuctInfo();
							dicInfo.TryGetValue(keyValuePair3.Key, out ductInfo);
							foreach (KeyValuePair<int, int> keyValuePair4 in dictionary)
							{
								bool flag6 = keyValuePair4.Key != keyValuePair3.Key;
								if (flag6)
								{
									bool flag7 = keyValuePair3.Value == 0 && !ductInfo.GetLstConnectStart.ContainsKey(keyValuePair4.Key);
									if (flag7)
									{
										ductInfo.GetLstConnectStart.Add(keyValuePair4.Key, keyValuePair4.Value);
									}
									else
									{
										bool flag8 = keyValuePair3.Value == 1 && !ductInfo.GetLstConnectEnd.ContainsKey(keyValuePair4.Key);
										if (flag8)
										{
											ductInfo.GetLstConnectEnd.Add(keyValuePair4.Key, keyValuePair4.Value);
										}
									}
								}
							}
						}
					}
				}
				catch (Exception)
				{
				}
			});
		}

		public List<Dictionary<int, DuctInfo>> DuctDivideSystem(Dictionary<int, DuctInfo> lstDoubleParaleCurves)
		{
			List<Dictionary<int, DuctInfo>> list = new List<Dictionary<int, DuctInfo>>();
			Dictionary<int, DuctInfo> item = new Dictionary<int, DuctInfo>();
			List<DuctInfo> list2 = new List<DuctInfo>();
			list2.AddRange(lstDoubleParaleCurves.Values);
			for (int i = 0; i < list2.Count; i++)
			{
				item = new Dictionary<int, DuctInfo>();
				bool flag = lstDoubleParaleCurves.ContainsKey(list2[i].Index);
				if (flag)
				{
					this.DuctDivideOneSystem(list2[i], ref lstDoubleParaleCurves, ref item);
					list.Add(item);
				}
			}
			return list;
		}

		private void DuctDivideOneSystem(DuctInfo ductInfo, ref Dictionary<int, DuctInfo> lstDoubleParaleCurves, ref Dictionary<int, DuctInfo> dicOneSys)
		{
			List<DuctInfo> list = new List<DuctInfo>();
			bool flag = lstDoubleParaleCurves.ContainsKey(ductInfo.Index);
			if (flag)
			{
				bool flag2 = ductInfo.GetLstConnectStart.Count == 0 && ductInfo.GetLstConnectEnd.Count == 0;
				if (flag2)
				{
					bool flag3 = !dicOneSys.ContainsKey(ductInfo.Index);
					if (flag3)
					{
						dicOneSys.Add(ductInfo.Index, ductInfo);
					}
				}
				else
				{
					bool flag4 = ductInfo.GetLstConnectStart.Count > 0;
					if (flag4)
					{
						foreach (KeyValuePair<int, int> keyValuePair in ductInfo.GetLstConnectStart)
						{
							DuctInfo item = new DuctInfo();
							lstDoubleParaleCurves.TryGetValue(keyValuePair.Key, out item);
							bool flag5 = !dicOneSys.ContainsKey(ductInfo.Index);
							if (flag5)
							{
								dicOneSys.Add(ductInfo.Index, ductInfo);
							}
							bool flag6 = lstDoubleParaleCurves.ContainsKey(ductInfo.Index);
							if (flag6)
							{
								lstDoubleParaleCurves.Remove(ductInfo.Index);
							}
							list.Add(item);
						}
					}
					bool flag7 = ductInfo.GetLstConnectEnd.Count > 0;
					if (flag7)
					{
						foreach (KeyValuePair<int, int> keyValuePair2 in ductInfo.GetLstConnectEnd)
						{
							DuctInfo item2 = new DuctInfo();
							lstDoubleParaleCurves.TryGetValue(keyValuePair2.Key, out item2);
							bool flag8 = !dicOneSys.ContainsKey(ductInfo.Index);
							if (flag8)
							{
								dicOneSys.Add(ductInfo.Index, ductInfo);
							}
							bool flag9 = lstDoubleParaleCurves.ContainsKey(ductInfo.Index);
							if (flag9)
							{
								lstDoubleParaleCurves.Remove(ductInfo.Index);
							}
							list.Add(item2);
						}
					}
					foreach (DuctInfo ductInfo2 in list)
					{
						bool flag10 = ductInfo2 != null;
						if (flag10)
						{
							this.DuctDivideOneSystem(ductInfo2, ref lstDoubleParaleCurves, ref dicOneSys);
						}
					}
				}
			}
		}

		public static List<Curve> LstTmpCurves = new List<Curve>();
	}
}
